home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / LISTVIEW.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  184 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1993, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Definition of class TListView
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_LISTVIEW_H)
  10. #define OWL_LISTVIEW_H
  11.  
  12. #if !defined(OWL_DOCMANAG_H)
  13. # include <owl/docmanag.h>
  14. #endif
  15. #if !defined(OWL_LISTBOX_H)
  16. # include <owl/listbox.h>
  17. #endif
  18. #include <owl/listview.rh>
  19.  
  20. #if defined(BI_NAMESPACE)
  21. namespace OWL {
  22. #endif
  23.  
  24. // Generic definitions/compiler options (eg. alignment) preceeding the 
  25. // definition of classes
  26. #include <services/preclass.h>
  27.  
  28. //
  29. // class TListView
  30. // ~~~~~ ~~~~~~~~~
  31. class _OWLCLASS TListView : public TListBox, public TView {
  32.   public:
  33.     TListView(TDocument& doc, TWindow* parent = 0);
  34.  
  35.     // Overridden virtuals from TView
  36.     //
  37.     const char far* GetViewName();
  38.     TWindow* GetWindow();
  39.     bool     SetDocTitle(const char far* docname, int index);
  40.  
  41.     // Overridden virtuals from TListBox
  42.     //
  43.     int  AddString(const char far* str);
  44.  
  45.     // Overridden virtuals from TWindow
  46.     //
  47.     bool CanClose();
  48.     bool Create();
  49.  
  50.     static const char far* StaticName();  // put in resource
  51.  
  52.   protected:
  53.     long GetOrigin() const;
  54.     void SetOrigin(long origin);
  55.  
  56.     int  GetMaxWidth() const;
  57.     void SetMaxWidth(int maxwidth);
  58.  
  59.     void SetExtent(const char far* str);
  60.     bool LoadData(int top, int sel);
  61.  
  62.     // Message response functions
  63.     //
  64.     void CmEditUndo();
  65.     void CmEditCut();
  66.     void CmEditCopy();
  67.     void CmEditPaste();
  68.     void CmEditDelete();
  69.     void CmEditClear();
  70.     void CmEditAdd();
  71.     void CmEditItem();
  72.     void CmSelChange();
  73.  
  74.     uint EvGetDlgCode(MSG far*);
  75.  
  76.     bool VnDocClosed(int omode);
  77.     bool VnCommit(bool force);
  78.     bool VnRevert(bool clear);
  79.     bool VnIsWindow(HWND hWnd);
  80.     bool VnIsDirty();
  81.  
  82.   public_data:
  83.     int  DirtyFlag;   // flag to indicate if the view is dirty
  84.  
  85.   protected_data:
  86.     long Origin;      // object's beginning position on the stream
  87.     int  MaxWidth;    // maximum horizontal extent
  88.  
  89.   DECLARE_RESPONSE_TABLE(TListView);
  90.   DECLARE_STREAMABLE(_OWLCLASS, TListView,1);
  91. };
  92.  
  93. // Generic definitions/compiler options (eg. alignment) following the 
  94. // definition of classes
  95. #include <services/posclass.h>
  96.  
  97. #if defined(BI_NAMESPACE)
  98. } // namespace OWL
  99. #endif
  100.  
  101. //----------------------------------------------------------------------------
  102. // Inline implementations
  103. //
  104.  
  105. //
  106. // Return the name of the view window.
  107. //
  108. inline const char far* TListView::StaticName() {
  109.   return "List View";
  110. }
  111.  
  112. //
  113. // Return the name of the view window.
  114. //
  115. inline const char far* TListView::GetViewName() {
  116.   return StaticName();
  117. }
  118.  
  119. //
  120. // Return the window object.
  121. //
  122. inline TWindow* TListView::GetWindow() {
  123.   return (TWindow*)this;
  124. }
  125.  
  126. //
  127. // Set the title for the document.
  128. //
  129. inline bool TListView::SetDocTitle(const char far* docname, int index) {
  130.   return TListBox::SetDocTitle(docname, index);
  131. }
  132.  
  133. //
  134. // Return true if both the listbox and the document can close.
  135. //
  136. inline bool TListView::CanClose() {
  137.   return TListBox::CanClose() && Doc->CanClose();
  138. }
  139.  
  140. //
  141. // Return the origin position on the persistent stream.
  142. //
  143. inline long TListView::GetOrigin() const {
  144.   return Origin;
  145. }
  146.  
  147. //
  148. // Set the position of the object.
  149. //
  150. inline void TListView::SetOrigin(long origin) {
  151.   Origin = origin;
  152. }
  153.  
  154. //
  155. // Return the maximum width of the strings.
  156. //
  157. inline int TListView::GetMaxWidth() const {
  158.   return MaxWidth;
  159. }
  160.  
  161. //
  162. // Set the maximum width of the strings.
  163. //
  164. inline void TListView::SetMaxWidth(int maxwidth) {
  165.   MaxWidth = maxwidth;
  166. }
  167.  
  168. //
  169. // Return true if the view's window and the parameter is the same.
  170. //
  171. inline bool TListView::VnIsWindow(HWND hWnd) {
  172.   return GetHandle() == hWnd;
  173. }
  174.  
  175. //
  176. // Return true if the view is dirty (modified) since the last save.
  177. //
  178. inline bool TListView::VnIsDirty() {
  179.   return DirtyFlag != 0;
  180. }
  181.  
  182.  
  183. #endif  // OWL_LISTVIEW_H
  184.